package com.ywk.pattern._6_decorator;

public class Person {
    public Person() {
    }

    private String name;

    public Person(String name) {
        this.name = name;
    }

    public void show() {
        System.out.println("装扮的" + name);
    }
}

class Finery extends Person {
    protected Person component;

    //打扮
    public void Decorate(Person component) {
        this.component = component;
    }

    @Override
    public void show() {
        if (component != null) {
            component.show();
        }
    }

}

class Tshirt extends Finery {
    @Override
    public void show() {

        System.out.println("大T恤");
        super.show();

    }
}

class BigTrouser extends Finery {
    @Override
    public void show() {

        System.out.println("垮裤");
        super.show();
    }
}

class Suite extends Finery {
    @Override
    public void show() {

        System.out.println("西装");
        super.show();
    }
}

